package com.soft.controller;

import com.soft.pojo.Emp;
import com.soft.service.WorkService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ruoxi
 * @create 2021-12-29 10:48
 */
@WebServlet("/showEmpInfoByEno")
public class ShowEmpInfoByEnoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int eno = Integer.parseInt(req.getParameter("eno"));

        WorkService workService = new WorkService();
        Emp emp = workService.findEmpByIntEno(eno);

        req.setAttribute("emp", emp);
        req.getRequestDispatcher("workerInfo.jsp").forward(req,resp);
    }
}
